import { RouteRecordRaw } from 'vue-router'

const UserLayout = () => import('@/views/layout/index.vue')

const news: RouteRecordRaw = {
  path: '/news',
  component: UserLayout,
  name: 'News',
  meta: {
    title: 'news'
  },
  redirect: '/news/animal',
  children: [
    {
      path: 'animal',
      component: () => import('@/views/news/animal.vue'),
      meta: {
        title: 'animalList'
      }
    },
    {
      path: 'nature',
      component: () => import('@/views/news/nature.vue'),
      name: 'NatureList',
      meta: {
        title: 'natureList'
      }
    },
    {
      path: 'article/:id',
      component: () => import('@/views/news/article.vue'),
      name: 'Article',
      meta: {
        title: 'article'
      },
      // 路由独享的守卫
      beforeEnter: (to, from) => {
        return true
      }
    }
  ]
}

export { news }
